Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@backstage/config
Advanced tools
@backstage/config is a configuration management library designed for use with Backstage, a platform for building developer portals. It provides a structured way to manage and access configuration data, supporting features like environment variable substitution, schema validation, and hierarchical configuration.
Loading Configuration
This feature allows you to load configuration data into a ConfigReader instance, which can then be used to access configuration values using a path-like syntax.
const { ConfigReader } = require('@backstage/config');
const config = new ConfigReader({
app: {
title: 'My App',
port: 3000
}
});
console.log(config.getString('app.title')); // Outputs: 'My App'
Environment Variable Substitution
This feature allows you to use environment variables within your configuration files, enabling dynamic configuration based on the environment.
const { ConfigReader } = require('@backstage/config');
process.env.APP_PORT = '4000';
const config = new ConfigReader({
app: {
port: '${APP_PORT}'
}
});
console.log(config.getNumber('app.port')); // Outputs: 4000
Schema Validation
This feature allows you to define a schema for your configuration and validate the configuration data against this schema, ensuring that the configuration is structured and typed correctly.
const { ConfigReader, ConfigSchema } = require('@backstage/config');
const schema = ConfigSchema.object({
app: ConfigSchema.object({
title: ConfigSchema.string(),
port: ConfigSchema.number()
})
});
const config = new ConfigReader({
app: {
title: 'My App',
port: 3000
}
});
schema.validate(config); // Validates the configuration against the schema
The 'config' package is a popular Node.js configuration management library that supports hierarchical configurations, environment variable overrides, and multiple configuration file formats. It is similar to @backstage/config in its ability to manage complex configurations but does not provide built-in schema validation.
The 'dotenv' package is a zero-dependency module that loads environment variables from a .env file into process.env. While it is simpler and more focused on environment variable management compared to @backstage/config, it lacks the hierarchical and schema validation features.
The 'convict' package provides a way to define a schema for configuration files, similar to @backstage/config. It supports environment variable overrides and validation, making it a close alternative for applications that require schema validation and structured configuration management.
This package provides a config API used by Backstage core, backend, and CLI.
Do not install this package directly, it is an internal package used by @backstage/core, @backstage/cli, and @backstage/backend-common. Depend on either of those instead.
FAQs
Config API used by Backstage core, backend, and CLI
The npm package @backstage/config receives a total of 46,733 weekly downloads. As such, @backstage/config popularity was classified as popular.
We found that @backstage/config demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.